home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / MIDI.h < prev    next >
Text File  |  1995-07-06  |  19KB  |  453 lines

  1. /*
  2.      File:        MIDI.h
  3.  
  4.      Contains:    MIDI Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __MIDI__
  21. #define __MIDI__
  22.  
  23.  
  24. #ifndef __ERRORS__
  25. #include <Errors.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __TYPES__
  30. #include <Types.h>
  31. #endif
  32.  
  33. #ifndef __MIXEDMODE__
  34. #include <MixedMode.h>
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_ALIGN_SUPPORTED
  42. #pragma options align=mac68k
  43. #endif
  44.  
  45. #if PRAGMA_IMPORT_SUPPORTED
  46. #pragma import on
  47. #endif
  48.  
  49. /*
  50.                         * * *  N O T E  * * * 
  51.  
  52.     This file has been updated to include MIDI 2.0 interfaces.  
  53.     
  54.     The MIDI 2.0 interfaces were developed for the classic 68K runtime.
  55.     Since then, Apple has created the PowerPC and CFM 68K runtimes.
  56.     Currently, the extra functions in MIDI 2.0 are not in InterfaceLib
  57.     and thus not callable from PowerPC and CFM 68K runtimes (you'll
  58.     get a linker error).  
  59. */
  60.  
  61. enum {
  62.     midiMaxNameLen                = 31,                            /*maximum number of characters in port and client names*/
  63. /* Time formats */
  64.     midiFormatMSec                = 0,                            /*milliseconds*/
  65.     midiFormatBeats                = 1,                            /*beats*/
  66.     midiFormat24fpsBit            = 2,                            /*24 frames/sec.*/
  67.     midiFormat25fpsBit            = 3,                            /*25 frames/sec.*/
  68.     midiFormat30fpsDBit            = 4,                            /*30 frames/sec. drop-frame*/
  69.     midiFormat30fpsBit            = 5,                            /*30 frames/sec.*/
  70.     midiFormat24fpsQF            = 6,                            /*24 frames/sec. longInt format */
  71.     midiFormat25fpsQF            = 7,                            /*25 frames/sec. longInt format */
  72.     midiFormat30fpsDQF            = 8,                            /*30 frames/sec. drop-frame longInt format */
  73.     midiFormat30fpsQF            = 9,                            /*30 frames/sec. longInt format */
  74.     midiInternalSync            = 0,                            /*internal sync*/
  75.     midiExternalSync            = 1,                            /*external sync*/
  76. /* Port types*/
  77.     midiPortTypeTime            = 0,                            /*time port*/
  78.     midiPortTypeInput            = 1,                            /*input port*/
  79.     midiPortTypeOutput            = 2,                            /*output port*/
  80.     midiPortTypeTimeInv            = 3,                            /*invisible time port*/
  81.     midiPortInvisible            = 0x8000,                        /*logical OR this to other types to make invisible ports*/
  82.     midiPortTypeMask            = 0x0007,                        /*logical AND with this to convert new port types to old,
  83.                                       ie. to strip the property bits*/
  84. /* OffsetTimes  */
  85.     midiGetEverything            = 0x7FFFFFFF,                    /*get all packets, regardless of time stamps*/
  86.     midiGetNothing                = 0x80000000L,                    /*get no packets, regardless of time stamps*/
  87.     midiGetCurrent                = 0x00000000                    /*get current packets only*/
  88. };
  89.  
  90. /*    MIDI data and messages are passed in MIDIPacket records (see below).
  91.     The first byte of every MIDIPacket contains a set of flags
  92.  
  93.     bits 0-1    00 = new MIDIPacket, not continued
  94.                      01 = begining of continued MIDIPacket
  95.                      10 = end of continued MIDIPacket
  96.                      11 = continuation
  97.     bits 2-3     reserved
  98.  
  99.     bits 4-6      000 = packet contains MIDI data
  100.  
  101.                   001 = packet contains MIDI Manager message
  102.  
  103.     bit 7         0 = MIDIPacket has valid stamp
  104.                   1 = stamp with current clock
  105. */
  106. enum {
  107.     midiContMask                = 0x03,
  108.     midiNoCont                    = 0x00,
  109.     midiStartCont                = 0x01,
  110.     midiMidCont                    = 0x03,
  111.     midiEndCont                    = 0x02,
  112.     midiTypeMask                = 0x70,
  113.     midiMsgType                    = 0x00,
  114.     midiMgrType                    = 0x10,
  115.     midiTimeStampMask            = 0x80,
  116.     midiTimeStampCurrent        = 0x80,
  117.     midiTimeStampValid            = 0x00,
  118. /* MIDIPacket command words (the first word in the data field for midiMgrType messages) */
  119.     midiOverflowErr                = 0x0001,
  120.     midiSCCErr                    = 0x0002,
  121.     midiPacketErr                = 0x0003,
  122. /*all command words less than this value are error indicators*/
  123.     midiMaxErr                    = 0x00FF,
  124. /* Valid results to be returned by readHooks */
  125.     midiKeepPacket                = 0,
  126.     midiMorePacket                = 1,
  127.     midiNoMorePacket            = 2,
  128.     midiHoldPacket                = 3,
  129. /* Driver calls */
  130.     midiOpenDriver                = 1,
  131.     midiCloseDriver                = 2
  132. };
  133.  
  134. enum {
  135.     mdvrAbortNotesOff            = 0,                            /*abort previous mdvrNotesOff request*/
  136.     mdvrChanNotesOff            = 1,                            /*generate channel note off messages*/
  137.     mdvrAllNotesOff                = 2,                            /*generate all note off messages*/
  138.     mdvrStopOut                    = 0,                            /*stop calling MDVROut temporarily*/
  139.     mdvrStartOut                = 1                                /*resume calling MDVROut*/
  140. };
  141.  
  142. struct MIDIPacket {
  143.     UInt8                            flags;
  144.     UInt8                            len;
  145.     long                            tStamp;
  146.     UInt8                            data[249];
  147. };
  148. typedef struct MIDIPacket MIDIPacket;
  149.  
  150. typedef MIDIPacket *MIDIPacketPtr;
  151.  
  152. typedef pascal short (*MIDIReadHookProcPtr)(MIDIPacketPtr myPacket, long myRefCon);
  153. typedef pascal void (*MIDITimeProcPtr)(long curTime, long myRefCon);
  154. typedef pascal void (*MIDIConnectionProcPtr)(short refnum, long refcon, short portType, OSType clientID, OSType portID, Boolean connect, short direction);
  155. typedef pascal long (*MDVRCommProcPtr)(short refnum, short request, long refCon);
  156. typedef pascal void (*MDVRTimeCodeProcPtr)(short refnum, short newFormat, long refCon);
  157. typedef pascal void (*MDVRReadProcPtr)(char *midiChars, short length, long refCon);
  158.  
  159. #if GENERATINGCFM
  160. typedef UniversalProcPtr MIDIReadHookUPP;
  161. typedef UniversalProcPtr MIDITimeUPP;
  162. typedef UniversalProcPtr MIDIConnectionUPP;
  163. typedef UniversalProcPtr MDVRCommUPP;
  164. typedef UniversalProcPtr MDVRTimeCodeUPP;
  165. typedef UniversalProcPtr MDVRReadUPP;
  166. #else
  167. typedef MIDIReadHookProcPtr MIDIReadHookUPP;
  168. typedef MIDITimeProcPtr MIDITimeUPP;
  169. typedef MIDIConnectionProcPtr MIDIConnectionUPP;
  170. typedef MDVRCommProcPtr MDVRCommUPP;
  171. typedef MDVRTimeCodeProcPtr MDVRTimeCodeUPP;
  172. typedef MDVRReadProcPtr MDVRReadUPP;
  173. #endif
  174.  
  175. struct MIDIClkInfo {
  176.     short                            syncType;                    /*synchronization external/internal*/
  177.     long                            curTime;                    /*current value of port's clock*/
  178.     short                            format;                        /*time code format*/
  179. };
  180. typedef struct MIDIClkInfo MIDIClkInfo;
  181.  
  182. struct MIDIIDRec {
  183.     OSType                            clientID;
  184.     OSType                            portID;
  185. };
  186. typedef struct MIDIIDRec MIDIIDRec;
  187.  
  188. struct MIDIPortInfo {
  189.     short                            portType;                    /*type of port*/
  190.     MIDIIDRec                        timeBase;                    /*MIDIIDRec for time base*/
  191.     short                            numConnects;                /*number of connections*/
  192.     MIDIIDRec                        cList[1];                    /*ARRAY [1..numConnects] of MIDIIDRec*/
  193. };
  194. typedef struct MIDIPortInfo MIDIPortInfo;
  195.  
  196. typedef MIDIPortInfo *MIDIPortInfoPtr, **MIDIPortInfoHdl, **MIDIPortInfoHandle;
  197.  
  198. struct MIDIPortParams {
  199.     OSType                            portID;                        /*ID of port, unique within client*/
  200.     short                            portType;                    /*Type of port - input, output, time, etc.*/
  201.     short                            timeBase;                    /*refnum of time base, 0 if none*/
  202.     long                            offsetTime;                    /*offset for current time stamps*/
  203.     MIDIReadHookUPP                    readHook;                    /*routine to call when input data is valid*/
  204.     long                            refCon;                        /*refcon for port (for client use)*/
  205.     MIDIClkInfo                        initClock;                    /*initial settings for a time base*/
  206.     Str255                            name;                        /*name of the port, This is a real live string, not a ptr.*/
  207. };
  208. typedef struct MIDIPortParams MIDIPortParams;
  209.  
  210. typedef MIDIPortParams *MIDIPortParamsPtr;
  211.  
  212. struct MIDIIDList {
  213.     short                            numIDs;
  214.     OSType                            list[1];
  215. };
  216. typedef struct MIDIIDList MIDIIDList;
  217.  
  218. typedef MIDIIDList *MIDIIDListPtr, **MIDIIDListHdl, **MIDIIDListHandle;
  219.  
  220. /* MDVR Control structs*/
  221. struct MDVRInCtlRec {
  222.     short                            timeCodeClock;                /*refnum of time base for time code*/
  223.     short                            timeCodeFormat;                /*format of time code output*/
  224.     MDVRReadUPP                        readProc;                    /*proc to call with intput characters*/
  225.     MDVRCommUPP                        commProc;                    /*proc to call for handshaking*/
  226.     long                            refCon;                        /*refCon passed to readProc, commProc*/
  227. };
  228. typedef struct MDVRInCtlRec *MDVRInCtlPtr;
  229.  
  230. struct MDVROutCtlRec {
  231.     short                            timeCodeClock;                /*time base driven by time code*/
  232.     short                            timeCodeFormat;                /*format of time code to listen to*/
  233.     MDVRTimeCodeUPP                    timeCodeProc;                /*proc called on time code fmt change*/
  234.     MDVRCommUPP                        commProc;                    /*proc called for handshaking*/
  235.     long                            refCon;                        /*refCon passed to timeCodeProc*/
  236.     Boolean                            timeCodeFilter;                /*filter time code if true*/
  237.     UInt8                            padding;                    /*unused pad byte*/
  238.     long                            midiMsgTicks;                /*value of Ticks when MIDI msg rcvd*/
  239.     long                            timeCodeTicks;                /*value of Ticks when time code rcvd*/
  240. };
  241. typedef struct MDVROutCtlRec *MDVROutCtlPtr;
  242.  
  243. typedef void *MDVRPtr;
  244.  
  245. /* MIDIVersion() return a NumVersion*/
  246. extern pascal unsigned long MIDIVersion(void)
  247.  FOURWORDINLINE(0x203C, 0x0000, 4, 0xA800);
  248. extern pascal OSErr MIDISignIn(OSType clientID, long refCon, Handle icon, ConstStr255Param name)
  249.  FOURWORDINLINE(0x203C, 0x0004, 4, 0xA800);
  250. extern pascal void MIDISignOut(OSType clientID)
  251.  FOURWORDINLINE(0x203C, 0x0008, 4, 0xA800);
  252. extern pascal MIDIIDListHandle MIDIGetClients(void)
  253.  FOURWORDINLINE(0x203C, 0x000C, 4, 0xA800);
  254. extern pascal void MIDIGetClientName(OSType clientID, Str255 name)
  255.  FOURWORDINLINE(0x203C, 0x0010, 4, 0xA800);
  256. extern pascal void MIDISetClientName(OSType clientID, ConstStr255Param name)
  257.  FOURWORDINLINE(0x203C, 0x0014, 4, 0xA800);
  258. extern pascal MIDIIDListHandle MIDIGetPorts(OSType clientID)
  259.  FOURWORDINLINE(0x203C, 0x0018, 4, 0xA800);
  260. extern pascal OSErr MIDIAddPort(OSType clientID, short BufSize, short *refnum, MIDIPortParamsPtr init)
  261.  FOURWORDINLINE(0x203C, 0x001C, 4, 0xA800);
  262. extern pascal MIDIPortInfoHandle MIDIGetPortInfo(OSType clientID, OSType portID)
  263.  FOURWORDINLINE(0x203C, 0x0020, 4, 0xA800);
  264. extern pascal OSErr MIDIConnectData(OSType srcClID, OSType srcPortID, OSType dstClID, OSType dstPortID)
  265.  FOURWORDINLINE(0x203C, 0x0024, 4, 0xA800);
  266. extern pascal OSErr MIDIUnConnectData(OSType srcClID, OSType srcPortID, OSType dstClID, OSType dstPortID)
  267.  FOURWORDINLINE(0x203C, 0x0028, 4, 0xA800);
  268. extern pascal OSErr MIDIConnectTime(OSType srcClID, OSType srcPortID, OSType dstClID, OSType dstPortID)
  269.  FOURWORDINLINE(0x203C, 0x002C, 4, 0xA800);
  270. extern pascal OSErr MIDIUnConnectTime(OSType srcClID, OSType srcPortID, OSType dstClID, OSType dstPortID)
  271.  FOURWORDINLINE(0x203C, 0x0030, 4, 0xA800);
  272. extern pascal void MIDIFlush(short refnum)
  273.  FOURWORDINLINE(0x203C, 0x0034, 4, 0xA800);
  274. extern pascal ProcPtr MIDIGetReadHook(short refnum)
  275.  FOURWORDINLINE(0x203C, 0x0038, 4, 0xA800);
  276. extern pascal void MIDISetReadHook(short refnum, ProcPtr hook)
  277.  FOURWORDINLINE(0x203C, 0x003C, 4, 0xA800);
  278. extern pascal void MIDIGetPortName(OSType clientID, OSType portID, Str255 name)
  279.  FOURWORDINLINE(0x203C, 0x0040, 4, 0xA800);
  280. extern pascal void MIDISetPortName(OSType clientID, OSType portID, ConstStr255Param name)
  281.  FOURWORDINLINE(0x203C, 0x0044, 4, 0xA800);
  282. extern pascal void MIDIWakeUp(short refnum, long time, long period, MIDITimeUPP timeProc)
  283.  FOURWORDINLINE(0x203C, 0x0048, 4, 0xA800);
  284. extern pascal void MIDIRemovePort(short refnum)
  285.  FOURWORDINLINE(0x203C, 0x004C, 4, 0xA800);
  286. extern pascal short MIDIGetSync(short refnum)
  287.  FOURWORDINLINE(0x203C, 0x0050, 4, 0xA800);
  288. extern pascal void MIDISetSync(short refnum, short sync)
  289.  FOURWORDINLINE(0x203C, 0x0054, 4, 0xA800);
  290. extern pascal long MIDIGetCurTime(short refnum)
  291.  FOURWORDINLINE(0x203C, 0x0058, 4, 0xA800);
  292. extern pascal void MIDISetCurTime(short refnum, long time)
  293.  FOURWORDINLINE(0x203C, 0x005C, 4, 0xA800);
  294. extern pascal void MIDIStartTime(short refnum)
  295.  FOURWORDINLINE(0x203C, 0x0060, 4, 0xA800);
  296. extern pascal void MIDIStopTime(short refnum)
  297.  FOURWORDINLINE(0x203C, 0x0064, 4, 0xA800);
  298. extern pascal void MIDIPoll(short refnum, long offsetTime)
  299.  FOURWORDINLINE(0x203C, 0x0068, 4, 0xA800);
  300. extern pascal OSErr MIDIWritePacket(short refnum, MIDIPacketPtr packet)
  301.  FOURWORDINLINE(0x203C, 0x006C, 4, 0xA800);
  302. extern pascal Boolean MIDIWorldChanged(OSType clientID)
  303.  FOURWORDINLINE(0x203C, 0x0070, 4, 0xA800);
  304. extern pascal long MIDIGetOffsetTime(short refnum)
  305.  FOURWORDINLINE(0x203C, 0x0074, 4, 0xA800);
  306. extern pascal void MIDISetOffsetTime(short refnum, long offsetTime)
  307.  FOURWORDINLINE(0x203C, 0x0078, 4, 0xA800);
  308. extern pascal long MIDIConvertTime(short srcFormat, short dstFormat, long time)
  309.  FOURWORDINLINE(0x203C, 0x007C, 4, 0xA800);
  310. extern pascal long MIDIGetRefCon(short refnum)
  311.  FOURWORDINLINE(0x203C, 0x0080, 4, 0xA800);
  312. extern pascal void MIDISetRefCon(short refnum, long refCon)
  313.  FOURWORDINLINE(0x203C, 0x0084, 4, 0xA800);
  314. extern pascal long MIDIGetClRefCon(OSType clientID)
  315.  FOURWORDINLINE(0x203C, 0x0088, 4, 0xA800);
  316. extern pascal void MIDISetClRefCon(OSType clientID, long refCon)
  317.  FOURWORDINLINE(0x203C, 0x008C, 4, 0xA800);
  318. extern pascal short MIDIGetTCFormat(short refnum)
  319.  FOURWORDINLINE(0x203C, 0x0090, 4, 0xA800);
  320. extern pascal void MIDISetTCFormat(short refnum, short format)
  321.  FOURWORDINLINE(0x203C, 0x0094, 4, 0xA800);
  322. extern pascal void MIDISetRunRate(short refnum, short rate, long time)
  323.  FOURWORDINLINE(0x203C, 0x0098, 4, 0xA800);
  324. extern pascal Handle MIDIGetClientIcon(OSType clientID)
  325.  FOURWORDINLINE(0x203C, 0x009C, 4, 0xA800);
  326. extern pascal ProcPtr MIDICallAddress(short callNum)
  327.  FOURWORDINLINE(0x203C, 164, 4, 0xA800);
  328. extern pascal void MIDISetConnectionProc(short refNum, ProcPtr connectionProc, long refCon)
  329.  FOURWORDINLINE(0x203C, 168, 4, 0xA800);
  330. extern pascal void MIDIGetConnectionProc(short refnum, ProcPtr *connectionProc, long *refCon)
  331.  FOURWORDINLINE(0x203C, 172, 4, 0xA800);
  332. extern pascal void MIDIDiscardPacket(short refnum, MIDIPacketPtr packet)
  333.  FOURWORDINLINE(0x203C, 176, 4, 0xA800);
  334. extern pascal OSErr MDVRSignIn(OSType clientID, long refCon, Handle icon, Str255 name)
  335.  FOURWORDINLINE(0x203C, 180, 4, 0xA800);
  336. extern pascal void MDVRSignOut(OSType clientID)
  337.  FOURWORDINLINE(0x203C, 184, 4, 0xA800);
  338. extern pascal MDVRPtr MDVROpen(short portType, short refnum)
  339.  FOURWORDINLINE(0x203C, 188, 4, 0xA800);
  340. extern pascal void MDVRClose(MDVRPtr driverPtr)
  341.  FOURWORDINLINE(0x203C, 192, 4, 0xA800);
  342. extern pascal void MDVRControlIn(MDVRPtr portPtr, MDVRInCtlPtr inputCtl)
  343.  FOURWORDINLINE(0x203C, 196, 4, 0xA800);
  344. extern pascal void MDVRControlOut(MDVRPtr portPtr, MDVROutCtlPtr outputCtl)
  345.  FOURWORDINLINE(0x203C, 200, 4, 0xA800);
  346. extern pascal void MDVRIn(MDVRPtr portPtr)
  347.  FOURWORDINLINE(0x203C, 204, 4, 0xA800);
  348. extern pascal void MDVROut(MDVRPtr portPtr, char *dataPtr, short length)
  349.  FOURWORDINLINE(0x203C, 208, 4, 0xA800);
  350. extern pascal void MDVRNotesOff(MDVRPtr portPtr, short mode)
  351.  FOURWORDINLINE(0x203C, 212, 4, 0xA800);
  352. enum {
  353.     uppMIDIReadHookProcInfo = kPascalStackBased
  354.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  355.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(MIDIPacketPtr)))
  356.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))),
  357.     uppMIDITimeProcInfo = kPascalStackBased
  358.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  359.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))),
  360.     uppMIDIConnectionProcInfo = kPascalStackBased
  361.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  362.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  363.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
  364.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(OSType)))
  365.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(OSType)))
  366.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(Boolean)))
  367.          | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(short))),
  368.     uppMDVRCommProcInfo = kPascalStackBased
  369.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  370.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  371.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  372.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  373.     uppMDVRTimeCodeProcInfo = kPascalStackBased
  374.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  375.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  376.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  377.     uppMDVRReadProcInfo = kPascalStackBased
  378.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char*)))
  379.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  380.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  381. };
  382.  
  383. #if GENERATINGCFM
  384. #define NewMIDIReadHookProc(userRoutine)        \
  385.         (MIDIReadHookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMIDIReadHookProcInfo, GetCurrentArchitecture())
  386. #define NewMIDITimeProc(userRoutine)        \
  387.         (MIDITimeUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMIDITimeProcInfo, GetCurrentArchitecture())
  388. #define NewMIDIConnectionProc(userRoutine)        \
  389.         (MIDIConnectionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMIDIConnectionProcInfo, GetCurrentArchitecture())
  390. #define NewMDVRCommProc(userRoutine)        \
  391.         (MDVRCommUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMDVRCommProcInfo, GetCurrentArchitecture())
  392. #define NewMDVRTimeCodeProc(userRoutine)        \
  393.         (MDVRTimeCodeUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMDVRTimeCodeProcInfo, GetCurrentArchitecture())
  394. #define NewMDVRReadProc(userRoutine)        \
  395.         (MDVRReadUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMDVRReadProcInfo, GetCurrentArchitecture())
  396. #else
  397. #define NewMIDIReadHookProc(userRoutine)        \
  398.         ((MIDIReadHookUPP) (userRoutine))
  399. #define NewMIDITimeProc(userRoutine)        \
  400.         ((MIDITimeUPP) (userRoutine))
  401. #define NewMIDIConnectionProc(userRoutine)        \
  402.         ((MIDIConnectionUPP) (userRoutine))
  403. #define NewMDVRCommProc(userRoutine)        \
  404.         ((MDVRCommUPP) (userRoutine))
  405. #define NewMDVRTimeCodeProc(userRoutine)        \
  406.         ((MDVRTimeCodeUPP) (userRoutine))
  407. #define NewMDVRReadProc(userRoutine)        \
  408.         ((MDVRReadUPP) (userRoutine))
  409. #endif
  410.  
  411. #if GENERATINGCFM
  412. #define CallMIDIReadHookProc(userRoutine, myPacket, myRefCon)        \
  413.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppMIDIReadHookProcInfo, (myPacket), (myRefCon))
  414. #define CallMIDITimeProc(userRoutine, curTime, myRefCon)        \
  415.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppMIDITimeProcInfo, (curTime), (myRefCon))
  416. #define CallMIDIConnectionProc(userRoutine, refnum, refcon, portType, clientID, portID, connect, direction)        \
  417.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppMIDIConnectionProcInfo, (refnum), (refcon), (portType), (clientID), (portID), (connect), (direction))
  418. #define CallMDVRCommProc(userRoutine, refnum, request, refCon)        \
  419.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppMDVRCommProcInfo, (refnum), (request), (refCon))
  420. #define CallMDVRTimeCodeProc(userRoutine, refnum, newFormat, refCon)        \
  421.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppMDVRTimeCodeProcInfo, (refnum), (newFormat), (refCon))
  422. #define CallMDVRReadProc(userRoutine, midiChars, length, refCon)        \
  423.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppMDVRReadProcInfo, (midiChars), (length), (refCon))
  424. #else
  425. #define CallMIDIReadHookProc(userRoutine, myPacket, myRefCon)        \
  426.         (*(userRoutine))((myPacket), (myRefCon))
  427. #define CallMIDITimeProc(userRoutine, curTime, myRefCon)        \
  428.         (*(userRoutine))((curTime), (myRefCon))
  429. #define CallMIDIConnectionProc(userRoutine, refnum, refcon, portType, clientID, portID, connect, direction)        \
  430.         (*(userRoutine))((refnum), (refcon), (portType), (clientID), (portID), (connect), (direction))
  431. #define CallMDVRCommProc(userRoutine, refnum, request, refCon)        \
  432.         (*(userRoutine))((refnum), (request), (refCon))
  433. #define CallMDVRTimeCodeProc(userRoutine, refnum, newFormat, refCon)        \
  434.         (*(userRoutine))((refnum), (newFormat), (refCon))
  435. #define CallMDVRReadProc(userRoutine, midiChars, length, refCon)        \
  436.         (*(userRoutine))((midiChars), (length), (refCon))
  437. #endif
  438.  
  439.  
  440. #if PRAGMA_IMPORT_SUPPORTED
  441. #pragma import off
  442. #endif
  443.  
  444. #if PRAGMA_ALIGN_SUPPORTED
  445. #pragma options align=reset
  446. #endif
  447.  
  448. #ifdef __cplusplus
  449. }
  450. #endif
  451.  
  452. #endif /* __MIDI__ */
  453.